<?php

namespace App\Model;

use App\BaseModel;

class ProductAttrLabel extends BaseModel
{
    protected $table = "product_attr_labels";

    protected $hidden =["attr_group_id","deleted_at","updated_at","created_at"];

    public function values()
    {
        return $this->hasMany('App\Model\ProductAttrValue','attr_label_id','id')
            ->orderBy('product_attr_values.sort','asc')
            ->orderBy('product_attr_values.id','asc');
    }

    public static function getLabelNameById($id)
    {
        $c = self::find($id);
        return $c?$c->name:'';
    }
}
